<div class="row premium">

    <% var emptyPhotoFile = "/resources/css/images/Home-green-48.png" %>

    <%
        var photoFile = emptyPhotoFile;
        if (announcement.get('realty').get('mainPhoto')) {
            var fileName = announcement.get('realty').get('mainPhoto').fileName;
            photoFile = "/resources/photo/" + fileName;
        }
    %>

    <% var typeRealty = announcement.get('realty').escape('type') %>

    <%
    var typeMetricLandArea = "";
    if (typeRealty == "LAND" || typeRealty == "HOUSE") {
        typeMetricLandArea = "";
        switch(announcement.get('realty').escape('typeMetricLandArea')) {
            case 'ha':
                typeMetricLandArea = "га";
                break;
            case 'm2':
                typeMetricLandArea = "кв. м.";
                break;
            case '100m2':
                typeMetricLandArea = "ар(100 кв. м.)";
                break;
        }
    }
    %>

    <% if (typeRealty == 'APARTMENT') { %>
    <div class="span3">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html" class="thumbnail" ><img alt="" src="<%= photoFile %>"></a>
        <h3>Цена: <%= announcement.get('price') %>$</h3>
        <h6>Количество комнат:<%= announcement.get('realty').get('numberRooms') %></h6>
        <h6>Дата публикации:<%= $.datepicker.formatDate('dd MM yy', new Date(announcement.get('datePublication'))) %></h6>
        <h6>Площадь: <%= announcement.get('realty').escape('area') %> кв. м.</h6>
    </div>

    <div class="span5">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html"><h3><%=announcement.get('operation') == "RENT" ? "Аренда" : "Продажа"  %> квартиры, <%= announcement.get('realty').get('numberRooms') %>к, <%= announcement.get('realty').escape('area') %> кв. м. </h3></a>
        <p><%=announcement.get('realty').escape('description') %></p>
        <p>Адрес: <%=announcement.get('realty').escape('adress') %></p>
    </div>
    <% } else if (typeRealty == 'HOUSE') { %>
    <div class="span3">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html" class="thumbnail" ><img alt="" src="<%= photoFile %>"></a>
        <h3>Цена: <%= announcement.get('price') %>$</h3>
        <h6>Количество комнат:<%= announcement.get('realty').get('numberRooms') %></h6>
        <h6>Дата публикации:<%= $.datepicker.formatDate('dd MM yy', new Date(announcement.get('datePublication'))) %></h6>
        <h6>Площадь: <%= announcement.get('realty').escape('area') %> кв. м.</h6>
        <h6>Площадь территории: <%= announcement.get('realty').escape('landArea') + " " + typeMetricLandArea %></h6>
    </div>

    <div class="span5">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html"><h3><%=announcement.get('operation') == "RENT" ? "Аренда " : "Проадажа "  %> дома, <%= announcement.get('realty').get('numberRooms') %>к, <%= announcement.get('realty').escape('area') %> кв. м. </h3></a>
        <p><%=announcement.get('realty').escape('description') %></p>
        <p>Адрес: <%=announcement.get('realty').escape('adress') %></p>
    </div>
    <% } else if (typeRealty == 'LAND') { %>
    <div class="span3">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html" class="thumbnail" ><img alt="" src="<%= photoFile %>"></a>
        <h3>Цена: <%= announcement.get('price') %>$</h3>
        <h6>Дата публикации:<%= $.datepicker.formatDate('dd MM yy', new Date(announcement.get('datePublication'))) %></h6>
        <h6>Площадь территории: <%= announcement.get('realty').escape('landArea') + " " + typeMetricLandArea %></h6>
    </div>

    <div class="span5">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html"><h3><%=announcement.get('operation') == "RENT" ? "Аренда " : "Проадажа "  %> земли, <%= announcement.get('realty').escape('landArea') + " " + typeMetricLandArea %> </h3></a>
        <p><%=announcement.get('realty').escape('description') %></p>
        <p>Адрес: <%=announcement.get('realty').escape('adress') %></p>
    </div>
    <% } else if (typeRealty == 'GARAGE') { %>
    <div class="span3">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html" class="thumbnail" ><img alt="" src="<%= photoFile %>"></a>
        <h3>Цена: <%= announcement.get('price') %>$</h3>
        <h6>Дата публикации:<%= $.datepicker.formatDate('dd MM yy', new Date(announcement.get('datePublication'))) %></h6>
        <h6>Площадь: <%= announcement.get('realty').escape('area') %> кв. м.</h6>
    </div>

    <div class="span5">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html"><h3><%=announcement.get('operation') == "RENT" ? "Аренда" : "Продажа"  %> гаража, <%= announcement.get('realty').escape('area') %> кв. м. </h3></a>
        <p><%=announcement.get('realty').escape('description') %></p>
        <p>Адрес: <%=announcement.get('realty').escape('adress') %></p>
    </div>
    <% } else if (typeRealty == 'OFFICE') { %>
    <div class="span3">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html" class="thumbnail" ><img alt="" src="<%= photoFile %>"></a>
        <h3>Цена: <%= announcement.get('price') %>$</h3>
        <h6>Количество комнат:<%= announcement.get('realty').get('numberRooms') %></h6>
        <h6>Дата публикации:<%= $.datepicker.formatDate('dd MM yy', new Date(announcement.get('datePublication'))) %></h6>
        <h6>Площадь: <%= announcement.get('realty').escape('area') %> кв. м.</h6>
    </div>

    <div class="span5">
        <a href="/announcementInfo/<%= announcement.get('id')%>.html"><h3><%=announcement.get('operation') == "RENT" ? "Аренда" : "Продажа"  %> офиса, <%= announcement.get('realty').get('numberRooms') %>к, <%= announcement.get('realty').escape('area') %> кв. м. </h3></a>
        <p><%=announcement.get('realty').escape('description') %></p>
        <p>Адрес: <%=announcement.get('realty').escape('adress') %></p>
    </div>
    <% } else { %>
        <h2 style="color:red">Програмная ошибка недвижимость не опознана!</h2>
    <% } %>
</div>
<hr />